package org.nanhill.moo.service;

import org.nanhill.commons.model.pagination.Pagination;
import org.nanhill.commons.pattern.domain.DomainAlreadyExistException;
import org.nanhill.commons.pattern.domain.DomainNotFoundException;
import org.nanhill.moo.domain.User;

/**
 * @author alin [xalinx at gmail dot com]
 * 
 */
public interface UserService {

	/**
	 * User logon.
	 * 
	 * @param email
	 * @param password
	 * @return
	 * @throws DomainNotFoundException
	 */
	User logon(String email, String password) throws DomainNotFoundException;

	/**
	 * Forbid user by user id.
	 * 
	 * @param userId
	 */
	void forbid(long userId);

	/**
	 * Open new user.
	 * 
	 * @param user
	 */
	void open(User user) throws DomainAlreadyExistException;

	/**
	 * Load user by id.
	 * 
	 * @param uid
	 * @return
	 * @throws DomainNotFoundException
	 */
	User loadById(long uid) throws DomainNotFoundException;

	/**
	 * Latest user Pagination.
	 * 
	 * @param pageId
	 * @return
	 */
	Pagination<User> loadPageLatest(int pageId, int pageSize);

}
